<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import MainLayout from '@/layouts/MainLayout.vue';

const route = useRoute();

// 不需要布局的页面（如登录页）
const noLayoutPages = ['/login', '/register'];
const needsLayout = computed(() => !noLayoutPages.includes(route.path));
</script>

<template>
  <div id="app">
    <!-- 需要布局的页面 -->
    <MainLayout v-if="needsLayout">
      <router-view />
    </MainLayout>

    <!-- 不需要布局的页面（如登录页） -->
    <router-view v-else />
  </div>
</template>

<style>
/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f7fa;
}

#app {
  height: 100vh;
}

/* Element Plus 样式覆盖 */
.el-menu--horizontal .el-menu-item:not(.is-disabled):hover,
.el-menu--horizontal .el-menu-item:not(.is-disabled):focus {
  background-color: transparent;
}

.el-menu--horizontal .el-menu-item.is-active {
  background-color: transparent;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 响应式工具类 */
.hidden-xs {
  display: block;
}

.hidden-sm {
  display: block;
}

@media (max-width: 768px) {
  .hidden-xs {
    display: none !important;
  }
}

@media (max-width: 992px) {
  .hidden-sm {
    display: none !important;
  }
}
</style>
